package com.qumitech.visualnovel.controller.rest;

import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.dao.app.VoiceRoom;
import com.qumitech.visualnovel.pubdef.dto.voiceroom.VoiceRoomVoiceAuditConfigOperationDTO;
import com.qumitech.visualnovel.pubdef.dto.voiceroom.VoiceRoomVoiceAuditResultOperationDTO;
import com.qumitech.visualnovel.service.voiceRoom.VoiceRoomVoiceAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/voiceroom/voice/audit")
public class VoiceRoomVoiceAuditController {
    @Autowired
    VoiceRoomVoiceAuditService voiceAuditService;

    @GetMapping("/result")
    public BaseRsp listVoiceAuditResult(@RequestParam(value = "uid", required = false) Long uid,
                                        @RequestParam(value = "risk_type", required = false) Integer riskType,
                                        @RequestParam(value = "risk_level", required = false) String riskLevel,
                                        @RequestParam(value = "from_start_time", required = false) String fromStartTime,
                                        @RequestParam(value = "to_start_time", required = false) String toStartTime,
                                        @RequestParam(value = "states", required = false) String states,
                                        @RequestParam("offset") Integer offset,
                                        @RequestParam("limit") Integer limit){
            return voiceAuditService.listVoiceAuditResult(uid,riskType,riskLevel,fromStartTime,toStartTime,states,offset,limit);
    }
    @PostMapping("/result/operation")
    public BaseRsp operateVoiceAuditResult(@RequestBody VoiceRoomVoiceAuditResultOperationDTO operationDTO){
            return voiceAuditService.operateVoiceAuditResult(operationDTO);
    }

    @GetMapping("/config")
    public BaseRsp listVoiceAuditConfig() {
        return voiceAuditService.listVoiceAuditConfig();
    }

    @PostMapping("/config")
    public BaseRsp saveVoiceAuditConfig(@RequestBody VoiceRoomVoiceAuditConfigOperationDTO operationDTO) {
        return voiceAuditService.saveVoiceAuditConfig(operationDTO);
    }

}
